package com.sync.syncmasterdata.product.repository.BPM;

import com.sync.syncmasterdata.product.entity.BPM.LdtItemSheetEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;


@Repository
public interface UpdateLdtItemSheetRepository extends JpaRepository<LdtItemSheetEntity,String> {
    /**
     * 根据明细表id执行更新
     * @param CRM_id
     * @param ERP_id
     * @param id
     */
    @Transactional
    @Modifying(clearAutomatically = true)
    @Query(nativeQuery = true, value= "UPDATE i0622_ldt_item_sheet set CRM_id =:CRM_id ,ERP_id=:ERP_id ,inventory_code_txt =:ERP_id  where id=:id")
    Integer getUpdateResults(@Param(value = "CRM_id") String CRM_id,@Param(value = "ERP_id") String ERP_id,@Param(value = "id") String id);


    @Transactional
    @Modifying(clearAutomatically = true)
    @Query(nativeQuery = true, value= "UPDATE i0622_ldt_item_flow set if_pushed ='是' where id=:id")
    Integer getUpdatePushed(@Param(value = "id") String id);

}
